# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Time        : 2021/9/10 17:51
@Author      : Albert Darren
@Contact     : 2563491540@qq.com
@File        : dicom_io.py
@Version     : Version 1.0.0
@Description : TODO
@Created By  : PyCharm
"""
from pydicom import dcmread, dcmwrite

# 读取dicom图像
dataset = dcmread("../experiment_fig/I1700000")
patient_name = dataset.PatientName
rows = dataset.Rows
columns = dataset.Columns
win_width = dataset.WindowWidth
win_center = dataset.WindowCenter
# 打印该图像的病人姓名、图像的行数和列数、图像的窗宽窗位
print("""该图像的病人姓名:{},
图像的行数:{},
列数:{},
图像窗宽:{},
窗位:{}""".format(patient_name, rows, columns, win_width, win_center))
dcmwrite("../experiment_fig/I1700000.jpg", dataset)
